package cn.jorian.framework.net;

import retrofit2.Retrofit;

/**
 * 项目名称：
 * 文件名称：NetManager
 * 文件描述：网络请求
 * 创建作者：胡涛
 * 创建日期：2020/9/18
 * 文件版本：1.0
 */
public class NetManager {

    private static NetManager manager;
    private ServiceApi serviceApi;

    private NetManager(String baseUrl) {
        Retrofit retrofit = RetrofitUtil.newInstance(baseUrl).getRetrofit();
        serviceApi = retrofit.create(ServiceApi.class);
    }

    public static NetManager newInstance() {
        if (manager == null) {
            synchronized (NetManager.class) {
                if (manager == null) {
                    manager = new NetManager(ServiceApi.IP);
                }
            }
        }
        return manager;
    }

    public ServiceApi getServiceApi() {
        return serviceApi;
    }
}
